<?php include_once './application/views/sys_admin/common/header.php';  ?>
<div class=" definewidth m20">
	<form action="/sys_admin/article/edit/" method="post" id="articleForm" name="articleForm"  enctype="multipart/form-data">
	<font color="red"><?php echo @validation_errors(); ?></font>
		<input type="hidden" id="id" name="id" value="<?php echo $article['id'];?>" />
		<input type="hidden" id="bthumbnail" name="bthumbnail" value="<?php echo $article['thumbnail'];?>" />
		<table class="table table-bordered table-hover m10">
			<tr>
		        <td class="tableleft">所属类别</td>
		        <td>
		        	<select id="nid" name="nid">
							<option value="0">--请选择类别--</option>
							<?php if($site_array){
								foreach($site_array as $key=>$v){
									?>
							<option <?php if($key == $article['nid']){?> selected="selected" <?php }?> value="<?php echo $key;?>">
								<?php echo $v;?>
							</option>
								<?php
								}
							}
							?>
					</select>
				</td>
		    </tr>
		    <tr>
		        <td class="tableleft">标题</td>
		        <td><input type="text" name="title" id="title" size="50"  value="<?php echo $article['title'];?>" /></td>
		    </tr>
		    <tr>
		        <td class="tableleft">作者</td>
		        <td><input type="text" name="author" id="author" size="50" value="<?php echo $article['author'];?>" /></td>
		    </tr>
		    <tr>
		        <td class="tableleft">上传图片</td>
		        <td><input type="file" name="thumbnail" id="thumbnail" /><img src="<?php echo $article['thumbnail'];?>" width="60" height="60"  /></td>
		    </tr>
		    <tr>
		        <td class="tableleft">显示时间</td>
		        <td><input type="text" name="ptime" id="ptime" value="<?php echo date('Y-m-d H:i', $article['ptime']);?>" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'})" readonly="readonly"  class="Wdate"/></td>
		    </tr>
		    <tr>
		        <td class="tableleft">排序</td>
		        <td><input type="text" name="forder" id="forder" value="<?php echo $article['forder'];?>" /></td>
		    </tr>
		    <tr>
		        <td class="tableleft">是否推荐 </td>
		        <td>
				<input type="radio" name="is_recommend" id="is_recommend" value="1" <?php if($article['is_recommend'] == 1){echo 'checked';}?> >是
				<input type="radio" name="is_recommend"id="is_recommend" value="0" <?php if($article['is_recommend'] == 0){echo 'checked';}?>>否
				</td>
		    </tr>
		    <tr>
		        <td class="tableleft">是否显示</td>
		        <td>
		        	<input type="radio" name="is_show"id="is_show" value="0" <?php if($article['is_show'] == 0){echo 'checked';}?>>是
					<input type="radio" name="is_show" id="is_show" value="1" <?php if($article['is_show'] == 1){echo 'checked';}?>>否
				</td>
		    </tr>
		    <tr>
		        <td class="tableleft">SEO内链关键词</td>
		        <td><textarea name="seo_keyword" id="seo_keyword" rows="5" cols="50"><?php echo $article['seo_keyword'];?></textarea></td>
		    </tr>
		    <tr>
		        <td class="tableleft">内容</td>
		        <td>
		        	<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
    				<script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.js"></script>
    				<script type="text/javascript" charset="utf-8">
				          var editor = new baidu.editor.ui.Editor();
				          editor.render('content');  //editor为编辑器容器的id
				      </script>
					<textarea name="content" id="content" style="width:800px">
					<?php echo $article['content'];?>
					</textarea>
				</td>
		    </tr>
		    <tr>
		        <td class="tableleft"> </td>
		        <td><button type="button" class="btn btn-success"  onclick="articleSubmit();" >提交</button> </td>
		    </tr>
		</table>
	</form>
			
</div>
<script type="text/javascript">
function articleSubmit(){
	var options = {
		url : '/sys_admin/article/edit/',
		dataType: "json",
		type:"post",
		success : function(ret) {
			if(ret.msg=='1'){
				alert("操作成功");
				window.location.href ='/sys_admin/article/zhs_articlelist';
			}else{
				alert(ret.msg);
			}
			
		}
	};
	$("#articleForm").ajaxSubmit(options);
	return false;
}
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
